<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
	<title></title>
</head>
<body>
	<H1>Website Payments Standard PHP Toolkit</H1>
	<STRONG>
		<P><B>VERSION 1.0.0</B></P>
	</STRONG>
	<P>This document describes web samples that use advanced features for Website
		Payments Standard - including button encryption, Payment Data Transfer (PDT),
		and Instant Payment Notification (IPN) in the following sections:</P>
	<UL type="disc">
		<LI>
		Intended audience
		<LI>
			<A href="#requiredsoftware">Required software</A>
		<LI>
			<A href="#installation">Installing the WPS PHP Toolkit</A>
		<LI>
			<A href="#runningsamples">Installing and Running the samples</A>
		<LI>
			<A href="#APIDocumentation">API documentation</A></LI>
	</UL>

	<DIV style="TEXT-ALIGN: center" align="center">
		<HR align="center" width="100%" SIZE="2">
	</DIV>

	<H2>Intended audience</H2>
	<P>
		The following are examples of Website Payments Standard's advanced features,
		which include code for its function:
	</P>
	<UL type="disc">
		<LI>
			<STRONG>Button encryption</STRONG> - Dynamically encrypt payment information
			with this script before sending the request to PayPal. Learn more at <A href="https://www.paypal.com/IntegrationCenter/ic_button-encryption.html">
			https://www.paypal.com/IntegrationCenter/ic_button-encryption.html</A>
		<LI>
			<STRONG>Payment Data Transfer -</STRONG> &nbsp;Pull payment data after a
			successful transaction with this script before sending the request to the
			PayPal. Learn more at&nbsp;<A href="https://www.paypal.com/IntegrationCenter/ic_pdt.html">https://www.paypal.com/IntegrationCenter/ic_pdt.html</A>
		<LI>
			<STRONG>Instant Payment Notification -&nbsp;</STRONG>Pull payment data after a
			successful transaction with this script, which provides data asynchronously.
			Learn more at&nbsp;<A href="https://www.paypal.com/IntegrationCenter/ic_ipn.html">https://www.paypal.com/IntegrationCenter/ic_ipn.html</A>.
		</LI>
	</UL>
	<P>
		These code samples aren't needed if you don't use these features. PayPal
		provides easier methods to create payment buttons. Learn more about buttons at&nbsp;<A href="https://www.paypal.com/IntegrationCenter/ic_standard_home.html#BuyNowButtons">https://www.paypal.com/IntegrationCenter/ic_standard_home.html#BuyNowButtons</A>
	</P>

	<DIV align="center">
		<HR align="center" width="100%" SIZE="2">
	</DIV>

	<H2>Required software<A name="requiredsoftware"></A></H2>
	<P>The following software is required:</P>
	<TABLE id="Table1" cellPadding="0" border="1">
		<TR>
			<TD>
				<P style="TEXT-ALIGN: center" align="center"><B>Software </B></P>
			</TD>
			<TD>
				<P style="TEXT-ALIGN: center" align="center"><B>Download Location </B></P>
			</TD>
		</TR>
		<TR>
			<TD height="40">
				<P>PHP 4.3.0 (or Higher)</P>
			</TD>
			<TD height="40">
				<P>
					<a href='http://www.php.net/downloads.php'>Download</a>
					<br>PayPal supports PHP version 4.3.0 or higher. PayPal recommends that you use the latest version.</br>
				</P>
			</TD>
		</TR>
		<TR>
			<TD>
				<P>PHP OpenSSL Extention</P>
			</TD>
			<TD>
				<P>
					<br>
						If you plan to use the Encrypted Website Payments (EWP) functionality of the SDK,
						you will need to install the PHP OpenSSL Extention.
					</br>
				</P>
			</TD>
		</TR>
		<TR>
			<TD>
				<P>OpenSSL</P>
			</TD>
			<TD>
				<P>
					<a href='http://www.openssl.org'>Download</a>
					<br>
						The PayPal PHP SDK requires you to encrypt your API Certificate into PKCS7 format.
						This step require the OpenSSL encryption tool.
					</br>
				</P>
			</TD>
		</TR>
	</TABLE>
	<P></P>

	<DIV align="center">
		<HR align="center" width="100%" SIZE="2">
	</DIV>

	<H2>Installing the WPS PHP Toolkit<A name="installation"></A></H2>
	<P>
		Unzip the PayPal_PHP_WPS_Toolkit.zip file, for example to C:\. You will
		see a paypal_php_wps_toolkit folder created under C:\.
	</P>

	<DIV align="center">
		<HR align="center" width="100%" SIZE="2">
	</DIV>

	<H2>Installing and Running the samples<A name="runningsamples"></A></H2>
	<P>Follow the instructions of the PayPal WPS Toolkit PHP Samples <A href='samples/README.txt'>README</A> file.<P>
	<P>The web samples consist of the following:</P>
	<UL type="disc">
		<LI>
			<A href="#creatingEncryptedButton">Creating an encrypted Buy Now button</A>
		<LI>
			<A href="#commonfiles">Common files</A>
		</LI>
	</UL>

	<P>The default EWP credentials used by these samples are:</P>
	<TABLE id="tablecredentials" cellPadding="0" border="1">
		<TR>
			<TD>Default Business Account:</TD>
			<TD>sdk-seller@sdk.com</TD>
		</TR>
		<TR>
			<TD>Cert ID:</TD>
			<TD>B62GVU8RWNBFC</TD>
		</TR>
		<TR>
			<TD>Path to EWP certificate:</TD>
			<TD>&lt;install_directory&gt;\samples\web\cert\my-pubcert.pem</TD>
		</TR>
		<TR>
			<TD>Path to EWP private key:</TD>
			<TD>&lt;install_directory&gt;\samples\web\cert\my-prvkey.pem</TD>
		</TR>
		<TR>
			<TD>Path to PayPal Public:</TD>
			<TD>certificate: &lt;install_directory&gt;\samples\web\cert\paypal_cert_pem.txt</TD>
		<TR>
	</TABLE>

	<P>The main page of the samples - index.html - contains links to each sample.</P>
	<P>&nbsp;</P>

	<H3>Creating an encrypted Buy Now button<A name="creatingEncryptedButton"></A></H3>
	<P>This sample shows how to dynamically encrypt payment data before sending the request to PayPal</P>
	<TABLE id="Table2" cellPadding="2" border="1">
		<TR>
			<TD vAlign="top"><STRONG>Encrypted Buy Now button</STRONG></TD>
			<TD>Create an encrypted Buy Now button and complete payment on PayPal</TD>
		</TR>
	</TABLE>
	<P>The primary files for this sample are:</P>
	<TABLE id="Table3" cellPadding="0" border="1">
		<TR>
			<TD width="153"><P align="center"><B>File</B></P></TD>
			<TD><P align="center"><B>Description</B></P></TD>
		</TR>
		<TR>
			<TD width="153"><A name="InputButtonParameters"></A><CODE>InputButtonParameters.php</CODE></TD>
			<TD>
				<P>This page collects payment parameters for the Buy Now button to be generated by encryption.</P>
				<P>Called by <A href="#index">index.html</A>.</P>
				<P>Calls <A href="#buynow">BuyNow.php</A>.</P>
			</TD>
		</TR>
		<TR>
			<TD width="153"><A name="buynow"></A><CODE>BuyNow.php</CODE></P></TD>
			<TD>
				<P>
					This page generates the encrypted BuyNow button using payment parameters
					collected through the <A href="#InputButtonParameters">InputButtonParameters.php</A> page.
				</P>
				<P>
					The code collects Buy Now parameters from the form displayed by
					InputButtonParameters.php then constructs Buy Now button by calling
					encryptButton method of the EWPServices class supplied with the toolkit.
				</P>
				<P>
					After the button parameters are signed and encrypted using the sdk-ewp-cert.pem certificate,
					the sdk-ewp-key.pem key, and the sandbox-cert.pem; the BuyNow button is displayed with the encrypted BLOB.
				</P>
				<P>Called by <A href="#InputButtonParameters">InputButtonParameters.php</A>.</P>
				<P>uses EWPServices class which in turn uses PPCrypto class. The encryption is done using PHP OenSSL Extention functions.</P>
			</TD>
		</TR>
		<TR>
			<TD width="153"><A name="PDTResponse"></A><CODE>PDTResponse.php</CODE></TD>
			<TD>
				<P>
					This page gets the PDT Get Parameters of the PDT transaction, and posts back
					the same to get the status of the Website Payments Standard transaction
				</P>
				<P>Called by PayPal to give notification about the Website Payment Standard transaction status.</P>
			</TD>
		</TR>
		<TR>
			<TD width="153"><A name="Credentials"></A><CODE>Credentials.php</CODE></TD>
			<TD>This page shows the credentials used for encrypting the Buy Now button.</TD>
		</TR>
		<TR>
			<TD width="153"><CODE>IPNListner.php</CODE></TD>
			<TD>This handler file listen for the IPN postback from the PayPal server, and logs a message in the IPN log file.</TD>
		</TR>
	</TABLE>
	<P>&nbsp;</P>

	<H3>Common files<A name="commonfiles"></A></H3>
	<TABLE id="Table4" cellPadding="0" border="1">
		<TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes">
			<TD width="84"><P style="TEXT-ALIGN: center" align="center"><B>File</B></P></TD>
			<TD><P style="TEXT-ALIGN: center" align="center"><B>Description</B></P></TD>
		</TR>
		<TR>
			<TD width="153"><A name="index"></A><CODE>index.html</CODE></TD>
			<TD>
				<P>The main web page with links to each sample.</P>
				<P>
					Calls <A href="#InputButtonParameters">InputButtonParameters.php</A>, paypal-ipn.log,
					and <A href="#Credentials">Credentials.php</A>.
				</P>
			</TD>
		</TR>
		<TR>
			<TD width="153"><CODE>sdk.css</CODE></TD>
			<TD>Cascading Style Sheet (CSS) used by all sample pages.</TD>
		</TR>
		<TR>
			<TD width="153"><CODE>utility.php</CODE></TD>
			<TD>
				<P>
					This is the configuration file for the samples.This file contains the parameters
					needed to encrypt the Buy Now button parameters.
				</P>
				<P>PayPal includes the following EWP credentials for encrypting the Buy Now button:</P>
				<TABLE cellPadding="0" border="1">
					<TR>
						<TD colSpan="2"><P align="center">EWP credentials</P></TD>
					</TR>
					<TR>
						<TD>Default Business Account</TD>
						<TD><CODE>sdk-three_api1.sdk.com</CODE></TD>
					</TR>
					<TR>
						<TD>Default Email Account</TD>
						<TD><CODE>sdk.seller@gmail.com</CODE></TD>
					</TR>
					<TR>
						<TD>Cert ID</TD>
						<TD><CODE>B62GVU8RWNBFC</CODE></TD>
					</TR>
					<TR>
						<TD>EWP certificate</TD>
						<TD><CODE>my-pubcert.pem</CODE></TD>
					</TR>
					<TR>
						<TD>EWP Private Key</TD>
						<TD><CODE>my-prvkey.pem</CODE></TD>
					</TR>
					<TR>
						<TD>Identity</TD>
						<TD><CODE>6vwLEY_ogPGnoQac2a0x4PRsSGrmzJPMkyGbJtpiCSwrkYsNSYxWfPY2ZLO<CODE></TD>
					</TR>
				</TABLE>
				<P>&nbsp;</P>
			</TD>
		</TR>
		<TR>
			<TD width="153"><CODE>paypal-ipn.log<CODE></TD>
			<TD>IPN log file - logs all IPN details received through listener with DateTime stamp.</TD>
		</TR>
	</TABLE>

	<DIV></DIV>

	<H2>Documentation<A name="APIDocumentation"></A></H2>
	<P>The <I>Website Payments Standard Integration Guide</I> is available in PDF format.</P>
	<TABLE cellPadding="2" border="1">
		<TR>
			<TD>PDF</TD>
			<TD>
				<A href="https://www.paypal.com/en_US/pdf/PP_WebsitePaymentsStandard_IntegrationGuide.pdf">
				https://www.paypal.com/en_US/pdf/PP_WebsitePaymentsStandard_IntegrationGuide.pdf</A>
			</TD>
		</TR>
	</TABLE>
	</SPAN></SPAN></SPAN></SPAN>
</body>
</html>
